#ifndef __NETWORK_INTERFACE__
#define __NETWORK_INTERFACE__

#include "websocket_handler.h"
#define PORT 21904
#define TIMEWAIT 100
#define BUFFLEN 2048
#define MAXEVENTSSIZE 20
typedef std::map<int, Websocket_Handler*> WEB_SOCKET_HANDLER_MAP;
typedef std::map<int, bool> WEB_SOCKET_ISH5_MAP;
class Network_Interface 
{
private:
    Network_Interface();
    ~Network_Interface();
    int init();
    int select_loop();
    void select_event(int fd, bool flag);
public:
    void run();
    static Network_Interface* get_share_network_interface();
private:
    int listenfd_;
    int fd_max;
    WEB_SOCKET_HANDLER_MAP websocket_handler_map_;
    static Network_Interface* m_network_interface;
    fd_set reads, cpy_reads;
};
#define NETWORK_INTERFACE Network_Interface::get_share_network_interface()
#endif
